package com.petsbang.http;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

import com.petsbang.action.LovelyActivity;
import com.petsbang.action.PetsMainActivity;
import com.petsbang.action.ShareActivity;
import com.petsbang.action.dao.DataApplication;
import com.petsbang.common.Common;
import com.petsbang.ui.DialogInfo;


public class DataHandler  extends Handler{
	final String tag = "dataHandler";
	Context context;
	public DataHandler(Context context){
		this.context = context;
	}
	@Override
	public void handleMessage(Message msg) {
		super.handleMessage(msg);
		Bundle mBundle = msg.getData();
		switch (msg.what) {
		case 0:{
			DialogInfo.showWifiDialog((Activity)context);
		}
		break;
		case Common.pic_type:{
			int status = mBundle.getInt(Common.status_str);
			if (status == Common.status_ringht) {
				PetsMainActivity am = (PetsMainActivity)context;
				am.InitLayout();
			}else{
				//失败
			}
			
		}
			break;
		case Common.share_type:{
			String imageUrl = mBundle.getString("url");
			if (imageUrl != null) {
				LovelyActivity la = (LovelyActivity)context;
				la.lovely.nodifyShareData(imageUrl);
			}
		}
			break;
			
		case Common.more_share_type:{
			String imageUrl = mBundle.getString("url");
			if (imageUrl != null) {
				ShareActivity la = (ShareActivity)context;
				la.nodifyShareData();
			}
		}
		break;
		
		default:
			break;
		}
		
	}
	

}
